#include "UtilityPCH.h"
#include "UT_StringHelper.h"

using namespace Utility;

//---------------------------------------------------------------------------
int32_t UT_StringHelper::StringToInt32(const StringType& rkString)
{
	return atoi(rkString.c_str());
}
//---------------------------------------------------------------------------
int64_t UT_StringHelper::StringToInt64(const StringType& rkString)
{
#if PLATFORM_TYPE == PLATFORM_WIN
	return _atoi64(rkString.c_str());
#endif

#if PLATFORM_TYPE == PLATFORM_LINUX
	return atoll(rkString.c_str());
#endif
}
//---------------------------------------------------------------------------
double UT_StringHelper::StringToDouble(const StringType& rkString)
{
	return atof(rkString.c_str());
}
//---------------------------------------------------------------------------
int32_t UT_StringHelper::WStringToInt32(const WStringType& rkWString)
{
	return _wtoi(rkWString.c_str());
}
//---------------------------------------------------------------------------
int64_t UT_StringHelper::WStringToInt64(const WStringType& rkWString)
{
#if PLATFORM_TYPE == PLATFORM_WIN
	return _wtoi64(rkWString.c_str());
#endif

#if PLATFORM_TYPE == PLATFORM_LINUX
	return atoll(rkWString.c_str());
#endif
}
//---------------------------------------------------------------------------
double UT_StringHelper::WStringToDouble(const WStringType& rkWString)
{
	return _wtof(rkWString.c_str());
}